import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './search.css';
import PubSub from 'pubsub-js'
class Search extends Component {
    
    search = () => {
        const { getName } = this.props
        const value = this.input.value.trim();
        if (value) {
            // getName(value);     
            PubSub.publish('my-search',value);      
        }
    }
    render() {
        return (
            <section className="jumbotron">
                <h3 className="jumbotron-heading">Search Github Users</h3>
                <div>
                    <input type="text" ref={input=>this.input = input} placeholder="enter the name you search" />
                    <button onClick={this.search}>Search</button>
                </div>
            </section>

        )
    }
}

export default Search
